package com.dean.utils;

import com.dean.dynamicexe.service.DeanDynamicCompilationService;
import com.dean.entity.DeanResponse;

import java.util.HashMap;
import java.util.Map;

public class DynamicCompilationTest {

    public static void main(String[] args) throws Exception {
        DeanDynamicCompilationService service = new DeanDynamicCompilationService();
        Map<String,String> params = new HashMap<>();
        params.put("name","测试中文名");
        DeanResponse response = service.dynamicExecute("D:\\Users\\dean\\git\\dean_tool\\src\\main\\resources\\scripts\\java\\Test2.java",params);
        System.out.println(response.toString());
    }
}


//    public static void main(String[] args) throws Exception {
//        // 4. 创建一个动态内存中的 Java 源文件对象
//        String sourceCode = "import java.util.Map;" +
//                "public class HelloWorld { \n" +
//                "   public void main(Map<String,String> params) { \n" +
//                "       System.out.println(\"Hello, world:\"+params.get(\"name\")); \n" +
//                "   } \n" +
//                "}";
//        DeanDynamicCompilationService dynamicCompilationUtils = new DeanDynamicCompilationService(sourceCode);
//        dynamicCompilationUtils.compiler();
//
//        Map<String,String> params = new HashMap<String,String>();
//        params.put("name","dean");
//        dynamicCompilationUtils.runMethod("HelloWorld","main",params);
//
//    }